#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(0),cin.tie(0)
#define ll long long
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define pb push_back
#define sorta(vec) sort(vec.begin(),vec.end())
#define sortd(vec) sort(vec.begin(),vec.end(),greater<int>())
#define pb push_back
#define vll vector<long long int>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>pbds; // find_by_order, order_of_key(0-indexed)
//less , less_equal , greater , greater_equal -> rule for insertion
#define start_execution auto start = std::chrono::high_resolution_clock::now();
#define stop_execution auto stop = std::chrono::high_resolution_clock::now();
#define execution_time auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(stop - start); cerr<<"Time taken : "<<((long double)duration.count())/((long double)1e9) <<"s"<<endl;
#define nline "\n"
#define all(v) (v).begin(),(v).end()
ll int mod=1e9+7;
void debug(int x)
{
cout<<"Value Debugged is "<<x<<endl;
}
void debug(vector<int>x)
{
cout<<"Value Debugged is "<<endl;
for(auto y:x)
{
cout<<y<<" ";
}
cout<<endl;
}
ll int inv(ll int r)
{
if(r==1) return 1;
return (mod-((mod/r)*inv(mod%r))%mod+mod)%mod;
}
int ceil_div(ll int a,ll int b)
{
int k=a%b;
if(k>0) return (a/b)+1;
return a/b;
}
template<class ForwardIterator>
void read(ForwardIterator first,ForwardIterator last)
{
while (first != last)
{
cin >> (*first);
++first;
}
}
template<class T>
void read(vector<T> &v)
{
read(v.begin(), v.end());
}
//Code starts here
vector<vector<int>>ans;
int dfs(int node,vector<vector<int>>&graph,vector<int>&temp)
{
//cout<<node<<endl;
if(node==4)
{
// cout<<"f"<<endl;
}
int demand=0;
if(graph[node].size()==0)
{
temp.push_back(node);
ans.push_back(temp);
//cout<<node<<endl;
return 1;
}
if(node==3)
{
//cout<<"demand"<<endl;
}
temp.push_back(node);
for(auto x:graph[node])
{
demand+=dfs(x,graph,temp);
temp.clear();
}
return demand;
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
fast;
start_execution
int tt=1;
//cin>>tt;
for(int cse=0;cse<tt;cse++)
{
bool ashish=false;
ll int n;
cin>>n;
vector<ll int>vec(n);
read(vec);
ll int ans=1e17;
for(int i=0;i<n;i++)
{
ll int prev=0;
ll int sum=0;
for(int j=i-1;j>=0;j--)
{
ll int temp=(prev/vec[j])+1;
sum+=temp;
prev=temp*vec[j];
}
prev=0;
for(int j=i+1;j<n;j++)
{
ll int temp=(prev/vec[j])+1;
sum+=temp;
prev=temp*vec[j];
}
ans=min(ans,sum);
}
cout<<ans<<endl;
}
stop_execution
execution_time
return 0;
}
1452A - Robot Program | 344A - Magnets |
96A - Football | 702B - Powers of Two |
1036A - Function Height | 443A - Anton and Letters |
1478B - Nezzar and Lucky Number | 228A - Is your horseshoe on the other hoof |
122A - Lucky Division | 1611C - Polycarp Recovers the Permutation |
432A - Choosing Teams | 758A - Holiday Of Equality |
1650C - Weight of the System of Nested Segments | 1097A - Gennady and a Card Game |
248A - Cupboards | 1641A - Great Sequence |
1537A - Arithmetic Array | 1370A - Maximum GCD |
149A - Business trip | 34A - Reconnaissance 2 |
59A - Word | 462B - Appleman and Card Game |
1560C - Infinity Table | 1605C - Dominant Character |
1399A - Remove Smallest | 208A - Dubstep |
1581A - CQXYM Count Permutations | 337A - Puzzles |
495A - Digital Counter | 796A - Buying A House |